<html>
<head><meta charset="utf-8"><title>non recursive Place construction · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html">non recursive Place construction</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="175665596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/175665596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#175665596">(Sep 13 2019 at 21:27)</a>:</h4>
<p>I was talking to <span class="user-mention" data-user-id="124288">@oli</span> about avoiding recursion when constructing place on mir build</p>



<a name="175665640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/175665640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#175665640">(Sep 13 2019 at 21:28)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> have some thoughts about it</p>



<a name="175823769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/175823769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#175823769">(Sep 16 2019 at 15:36)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> told me some days ago ...</p>



<a name="175823803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/175823803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#175823803">(Sep 16 2019 at 15:36)</a>:</h4>
<div class="codehilite"><pre><span></span>nikomatsakis: I just think working recursively is more natural
nikomatsakis: I think what I had in mind was that we returned not a Place
nikomatsakis: but rather a PlaceBuilder
nikomatsakis: that accumulates into a Vec
nikomatsakis: and then has some kind of into_place method that does the interning
</pre></div>



<a name="175823810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/175823810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#175823810">(Sep 16 2019 at 15:37)</a>:</h4>
<p>/cc <span class="user-mention" data-user-id="124288">@oli</span></p>



<a name="175824914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/175824914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#175824914">(Sep 16 2019 at 15:49)</a>:</h4>
<p>as long as we don't end up with actual recursion... I don't care much about the API. We have stack overflows in degenerate usercode that can only be solved by moving to iteration</p>



<a name="175933156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/175933156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#175933156">(Sep 17 2019 at 18:10)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I was talking with <span class="user-mention" data-user-id="124288">@oli</span> about making this part iterative and we were wondering what to do with <a href="https://github.com/rust-lang/rust/blob/f504e37dc64b2f00291f53517fe9cb2329d00fb8/src/librustc_mir/build/expr/as_place.rs#L55-L61" target="_blank" title="https://github.com/rust-lang/rust/blob/f504e37dc64b2f00291f53517fe9cb2329d00fb8/src/librustc_mir/build/expr/as_place.rs#L55-L61">https://github.com/rust-lang/rust/blob/f504e37dc64b2f00291f53517fe9cb2329d00fb8/src/librustc_mir/build/expr/as_place.rs#L55-L61</a></p>



<a name="175933168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/175933168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#175933168">(Sep 17 2019 at 18:10)</a>:</h4>
<p>I guess this is why you've said that the recursion is more natural?</p>



<a name="175933175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/175933175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#175933175">(Sep 17 2019 at 18:10)</a>:</h4>
<p>the rest of the cases are pretty straightforward</p>



<a name="175933225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/175933225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#175933225">(Sep 17 2019 at 18:11)</a>:</h4>
<p>what I'm going to do, is keep recursion there and pass a vec around which I keep filling</p>



<a name="175933359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/175933359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#175933359">(Sep 17 2019 at 18:12)</a>:</h4>
<p>you were mentioning a <code>PlaceBuilder</code> unsure what idea exactly you had in mind and if that could solve the <code>in_scope</code> problem</p>



<a name="176099747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176099747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176099747">(Sep 19 2019 at 13:37)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I was talking with <span class="user-mention" data-user-id="124288">@oli</span> about this</p>



<a name="176099762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176099762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176099762">(Sep 19 2019 at 13:38)</a>:</h4>
<p>I've done a quick and dirty try on making things iterate there</p>



<a name="176099803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176099803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176099803">(Sep 19 2019 at 13:38)</a>:</h4>
<p>this <a href="https://github.com/rust-lang/rust/compare/master...spastorino:make-place-build-iterative?w=1" target="_blank" title="https://github.com/rust-lang/rust/compare/master...spastorino:make-place-build-iterative?w=1">https://github.com/rust-lang/rust/compare/master...spastorino:make-place-build-iterative?w=1</a> is what I have</p>



<a name="176099817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176099817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176099817">(Sep 19 2019 at 13:38)</a>:</h4>
<p>as you can see, it's bad :P</p>



<a name="176099865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176099865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176099865">(Sep 19 2019 at 13:38)</a>:</h4>
<p>mainly we need to get somethings upfront in a lot of cases so we need to recurse anyway</p>



<a name="176099954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176099954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176099954">(Sep 19 2019 at 13:39)</a>:</h4>
<p>like for instance <a href="https://github.com/rust-lang/rust/compare/master...spastorino:make-place-build-iterative?w=1#diff-cfb4737a5d62dc17cfbc2d1f73ffff35R90" target="_blank" title="https://github.com/rust-lang/rust/compare/master...spastorino:make-place-build-iterative?w=1#diff-cfb4737a5d62dc17cfbc2d1f73ffff35R90">https://github.com/rust-lang/rust/compare/master...spastorino:make-place-build-iterative?w=1#diff-cfb4737a5d62dc17cfbc2d1f73ffff35R90</a></p>



<a name="176100158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176100158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176100158">(Sep 19 2019 at 13:41)</a>:</h4>
<p>I guess maybe this are the kind of things we were referring to when you've said that recursion is more natural in this case?</p>



<a name="176100223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176100223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176100223">(Sep 19 2019 at 13:42)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> when you have some time to check this out, would be nice to hear from you on what to do here :)</p>



<a name="176100558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176100558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176100558">(Sep 19 2019 at 13:45)</a>:</h4>
<p>I should've probably read nikos chat log better... We can return a builder (glorified <code>(PlaceBase, Vec&lt;PlaceElem&gt;)</code>) instead of a <code>Place</code> and give that a <code>finish</code> method for getting a <code>Place</code> out of it</p>



<a name="176100608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176100608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176100608">(Sep 19 2019 at 13:46)</a>:</h4>
<p>then, when all you do is push an element and return, all we need to do is push to the builder</p>



<a name="176100741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176100741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176100741">(Sep 19 2019 at 13:47)</a>:</h4>
<p>yeah and most of the logic we have right now is done in the "finish" fn or as Niko said "into_place"</p>



<a name="176100863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176100863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176100863">(Sep 19 2019 at 13:48)</a>:</h4>
<p>to be more clear, I meant, most of what we have right now in <code>expr_as_place</code> moves to <code>finish</code> or <code>into_place</code> or whatever we call it</p>



<a name="176138065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176138065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176138065">(Sep 19 2019 at 20:21)</a>:</h4>
<blockquote>
<p>as long as we don't end up with actual recursion... I don't care much about the API. We have stack overflows in degenerate usercode that can only be solved by moving to iteration</p>
</blockquote>
<p>hmm, I wasn't trying to solve that problem, which I thought we'd solve by just growing the stack</p>



<a name="176138095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176138095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176138095">(Sep 19 2019 at 20:21)</a>:</h4>
<p>this is what I meant by "recursion is just more natural"</p>



<a name="176138114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176138114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176138114">(Sep 19 2019 at 20:21)</a>:</h4>
<blockquote>
<p>I should've probably read nikos chat log better... We can return a builder (glorified <code>(PlaceBase, Vec&lt;PlaceElem&gt;)</code>) instead of a <code>Place</code> and give that a <code>finish</code> method for getting a <code>Place</code> out of it</p>
</blockquote>
<p>this is what I was proposing, yes</p>



<a name="176138333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176138333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176138333">(Sep 19 2019 at 20:23)</a>:</h4>
<blockquote>
<p>to be more clear, I meant, most of what we have right now in <code>expr_as_place</code> moves to <code>finish</code> or <code>into_place</code> or whatever we call it</p>
</blockquote>
<p>basically this ^^^?</p>



<a name="176138451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176138451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176138451">(Sep 19 2019 at 20:24)</a>:</h4>
<p>I meant, now there we just construct the builder and move the logic on <code>expr_as_place</code> to the <code>finish</code>?, that's what you meant?</p>



<a name="176167635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176167635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176167635">(Sep 20 2019 at 06:08)</a>:</h4>
<p>all the logic will still happen where it does, but it won't build an actual <code>Place</code>, it will delay that until a <code>Place</code> is needed</p>



<a name="176167711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176167711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176167711">(Sep 20 2019 at 06:10)</a>:</h4>
<p>essentially:</p>
<ol>
<li>change the return type to the builder</li>
<li>change all return sites to emit a builder (by just doing what's being done now: <code>.to_vec()</code> the projection and clone the base)</li>
<li>Add a <code>.finish()</code> to all call sites</li>
<li>get rid of unnecessary <code>.finish().to_builder()</code> calls by pushing to the <code>projections</code> <code>Vec</code> and returning the builder unfinished</li>
</ol>



<a name="176947496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176947496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176947496">(Sep 30 2019 at 16:12)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="124288">@oli</span> <a href="https://github.com/rust-lang/rust/pull/64922" target="_blank" title="https://github.com/rust-lang/rust/pull/64922">https://github.com/rust-lang/rust/pull/64922</a></p>



<a name="176965175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176965175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176965175">(Sep 30 2019 at 19:27)</a>:</h4>
<p>nice, <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> :)</p>



<a name="176970651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176970651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176970651">(Sep 30 2019 at 20:24)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="124288">@oli</span> what I've said about removing this functions <a href="https://github.com/rust-lang/rust/blob/40a5331753e44ef8ef2d0b68fe6ee35234ab82ad/src/librustc/mir/mod.rs#L1862-L1894" target="_blank" title="https://github.com/rust-lang/rust/blob/40a5331753e44ef8ef2d0b68fe6ee35234ab82ad/src/librustc/mir/mod.rs#L1862-L1894">https://github.com/rust-lang/rust/blob/40a5331753e44ef8ef2d0b68fe6ee35234ab82ad/src/librustc/mir/mod.rs#L1862-L1894</a> from <code>Place</code> doesn't seem to be a good idea, unsure if you have some thoughts about it</p>



<a name="176970696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176970696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176970696">(Sep 30 2019 at 20:24)</a>:</h4>
<p>there are some cases outside <code>as_place</code> where it's clearly not convenient</p>



<a name="176970719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176970719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176970719">(Sep 30 2019 at 20:24)</a>:</h4>
<p>we may end converting a Place to a PlaceBuilder to convert it back to Place, so things will be worser</p>



<a name="176970753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176970753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176970753">(Sep 30 2019 at 20:25)</a>:</h4>
<p>but I was hoping there were cases where those calls could be converted to use the builder</p>



<a name="176970761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176970761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176970761">(Sep 30 2019 at 20:25)</a>:</h4>
<p>doesn't seem like that though</p>



<a name="176971599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176971599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176971599">(Sep 30 2019 at 20:35)</a>:</h4>
<p>other than changing this <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/build/expr/as_rvalue.rs#L290" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/build/expr/as_rvalue.rs#L290">as_place</a> call with a call to <code>as_place_builder</code> and then call PlaceBuilder's <code>field</code> method followed by an <code>as_place</code> call <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/build/expr/as_rvalue.rs#L300" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/build/expr/as_rvalue.rs#L300">here</a></p>



<a name="176971606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176971606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176971606">(Sep 30 2019 at 20:35)</a>:</h4>
<p>unsure if it worth doing that</p>



<a name="176971931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176971931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176971931">(Sep 30 2019 at 20:39)</a>:</h4>
<p>it's inside a closure, so I'd need to clone it all the times that's called anyway</p>



<a name="176971955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/176971955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#176971955">(Sep 30 2019 at 20:39)</a>:</h4>
<p>I guess it ends being more or less equivalent</p>



<a name="177057541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/177057541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#177057541">(Oct 01 2019 at 14:00)</a>:</h4>
<p>so ... we have perf results for <a href="https://github.com/rust-lang/rust/pull/64922" target="_blank" title="https://github.com/rust-lang/rust/pull/64922">https://github.com/rust-lang/rust/pull/64922</a></p>



<a name="177057568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/177057568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#177057568">(Oct 01 2019 at 14:00)</a>:</h4>
<p>it doesn't seem to be showing useful wins</p>



<a name="177057593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/177057593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#177057593">(Oct 01 2019 at 14:00)</a>:</h4>
<p>/cc <span class="user-mention" data-user-id="124288">@oli</span> <span class="user-mention" data-user-id="116009">@nikomatsakis</span> others that want to check this out ^^^</p>



<a name="177145971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/177145971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#177145971">(Oct 02 2019 at 12:49)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> was talking with <span class="user-mention" data-user-id="116009">@nikomatsakis</span> in private and he thinks that we should merge this, he wasn't expecting huge wins neither</p>



<a name="177145973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/177145973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#177145973">(Oct 02 2019 at 12:49)</a>:</h4>
<p>I've said that I was expecting a bit more but still ...</p>



<a name="177146137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/non%20recursive%20Place%20construction/near/177146137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/non.20recursive.20Place.20construction.html#177146137">(Oct 02 2019 at 12:51)</a>:</h4>
<p>sgtm</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>